package ai.people.netmon.telegram.service;

import ai.people.netmon.framework.domain.searchmsg.request.MessageRequest;
import ai.people.netmon.framework.domain.telegram.entity.Messages;
import ai.people.netmon.framework.domain.telegram.vo.channels.ChatMessage;
import ai.people.netmon.framework.model.request.PageKeyWordsRequest;
import ai.people.netmon.framework.model.response.PageResponse;

/**
 * @author xing.wei
 * @description:业务层
 * @since 2022-01-06 17:10:52
 */
public interface MessagesService {

    /**
     * 分页查询信息列表
     *
     * @param pageKeyWordsRequest 页面关键字请求
     * @return {@link PageResponse}<{@link ChatMessage}>
     */
    PageResponse<ChatMessage> businessChannelsList(PageKeyWordsRequest pageKeyWordsRequest);


    /**
     * 全球信息搜索
     *
     * @param messageRequest 消息请求
     * @return {@link PageResponse}<{@link Messages}>
     */
    PageResponse<ChatMessage> globalInfoSearch(MessageRequest messageRequest);

    //@Autowired
    //private MessagesMapper messagesMapper;
    //
    ///**
    // * 数据列表
    // */
    //public QueryResponsePageResult<Messages> listMessagessByPage(RequestQueryListData query) {
    //    Integer pageNo = query.getPageNo();
    //    Integer pageSize = query.getPageSize();
    //    Map<String, List<String>> sortBies = query.getSortBy();
    //    Map<String, List<Boolean>> descs = query.getDesc();
    //    String key = query.getSearchKeywords();
    //
    //    Page<Messages> page = new Page<>(pageNo, pageSize);
    //
    //    QueryWrapper queryWrapper = new QueryWrapper();
    //    if (StringUtils.isNotBlank(key)) {
    //        queryWrapper.like("code", "%" + key + "%");
    //    }
    //
    //    if (!CollectionUtils.isEmpty(sortBies)) {
    //        List<String> sortList = sortBies.get("");
    //        List<Boolean> descList = descs.get("");
    //        for (int i = 0; i < sortList.size(); i++) {
    //            page.addOrder(descList.get(i) ? OrderItem.desc("" + sortList.get(i) + "") : OrderItem.asc("" + sortList.get(i) + ""));
    //        }
    //    }
    //
    //    Page<Messages> result = messagesMapper.selectPage(page, queryWrapper);
    //
    //    QueryResult<Messages> courseIncfoQueryResult = new QueryResult<>();
    //    courseIncfoQueryResult.setList(result.getRecords());
    //    courseIncfoQueryResult.setTotal(result.getTotal());
    //    return new QueryResponsePageResult<Messages>(CommonCode.SUCCESS, courseIncfoQueryResult);
    //}

    ///**
    // * 根据id查询信息
    // */
    //public QueryResponseObjectResult getMessagesById(@PathVariable("id") Long id, @PathVariable("chatId") Long chatId) {
    //    if (id == null || id < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //    if (chatId == null || chatId < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //
    //    return new QueryResponseObjectResult<Messages>(CommonCode.SUCCESS, messagesMapper.selectById(id, chatId));
    //}
    //
    ///**
    // * 添加
    // */
    //public QueryResponseObjectResult addMessages(Messages info) {
    //    int num = messagesMapper.insert(info);
    //
    //    if (num > 0) {
    //        return new QueryResponseObjectResult(CommonCode.SUCCESS_ADD, info);
    //    } else {
    //        return new QueryResponseObjectResult(CommonCode.FAIL_ADD, null);
    //    }
    //}
    //
    //
    ///**
    // * 根据id修改
    // */
    //public QueryResponseObjectResult updateMessagesById(Messages info) {
    //    if (info == null || info.getId() == null || info.getId() < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //    if (info == null || info.getChatId() == null || info.getChatId() < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //
    //    int num = messagesMapper.updateById(info);
    //
    //    if (num > 0) {
    //        return new QueryResponseObjectResult(CommonCode.SUCCESS_UPDATE, info);
    //    } else {
    //        return new QueryResponseObjectResult(CommonCode.FAIL_UPDATE, info);
    //    }
    //}

    ///**
    // * 根据id删除
    // */
    //public ResponseResult deleteMessagesById(@PathVariable("id") Long id, @PathVariable("chatId") Long chatId) {
    //    if (id == null || id < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //    if (chatId == null || chatId < 1) {
    //        return new QueryResponseObjectResult(CommonCode.CHECK_NOT_EMPTY_PRIMARY_ID, null);
    //    }
    //
    //    int num = messagesMapper.deleteById(id, chatId);
    //
    //    if (num > 0) {
    //        return new ResponseResult(CommonCode.SUCCESS_DELETE);
    //    } else {
    //        return new ResponseResult(CommonCode.FAIL_DELETE);
    //    }
    //}

}